﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ABELGX
{
    /// <summary>
    /// PageRule.xaml 的交互逻辑
    /// </summary>
    public partial class PageRule : Page
    {
        public Car Car { get; private set; }
        public PageRule()
        {
            InitializeComponent();
        }
        public void SetCar(Car car)
        {
            Car = car;
            if (Car == null)
            {
                return;
            }
            new SwitchVM(LightType, Car.CmdCommon.LightType, Car.InfoCommon.LightType);
            new SwitchVM(SprayType, Car.CmdCommon.SprayType, Car.InfoCommon.SprayType);
            new SwitchVM(AirOpen, Car.CmdCommon.AirOpen, Car.InfoCommon.AirOpen);
            new SwitchVM(MotorSync, Car.CmdCommon.MotorSync, Car.InfoCommon.MotorSync);
            new SwitchVM(Beep, Car.CmdCommon.Beep, Car.InfoCommon.Beep);
            new SwitchVM(Generator, Car.CmdCommon.Generator, Car.InfoCommon.Generator);
            new SwitchVM(HighSpeaker, Car.CmdCommon.HighSpeaker, Car.InfoCommon.HighSpeaker);
            new SwitchVM(Custom9, Car.CmdCommon.Customize[8], Car.InfoCommon.Customize[8]);
            new SwitchVM(Custom10, Car.CmdCommon.Customize[9], Car.InfoCommon.Customize[9]);
            new ButtonVM(DriverReset, ButtonVMType.Press, Car.CmdCommon.DriverReset, Car.InfoCommon.DriverReset);
        }
    }
}
